import Vue from 'vue'

// 作用：重置咱们默认的css的样式 类似reset.css
import 'normalize.css/normalize.css' // A modern alternative to CSS resets

// 导入elementui及对应样式
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import request from '@/utils/request'

import '@/icons' // icon
import '@/permission' // permission control
// import { imgerror, color } from '@/dretives'
// Vue.directive('imgerror', imgerror)
// Vue.directive('color', color)

// import * as directives from '@/directives'
// // 遍历得到的对象, 批量进行自定义指令的注册
// for (const key in directives) {
//   // console.log(key, directives[key])
//   Vue.directive(key, directives[key])
// }

import * as directives from '@/directives'

Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
Vue.prototype.$request = request
Vue.config.productionTip = false
// process.env 固定用法 读取环境变量文件
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
